import gaesessions

import os
COOKIE_KEY = '\xfbvoe6\x04I\xe5\x84J\xaa\x90\x08rk\x04\x160\x81\x8a\x86q\xddA4'\
             '\xcd\x96\x95>\x0c\xaa\xf9\xdc\x1f\x80C\x89\x1b\xde\xbb\xab\xe7'\
             '\xdf&+\xc8\xf6<l\x98\xd5R-Np\x16\x0f\x92J\xe7(kQ?'

def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = gaesessions.SessionMiddleware(app, cookie_key=COOKIE_KEY)
  app = recording.appstats_wsgi_middleware(app)
  return app
